home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / MODEMPRO / ZOC132.ZIP;1 / ZOC / SCRIPT / XDIAL < prev   
Encoding:
Text File  |  1994-05-13  |  3.7 KB  |  196 lines

  1.     #    The XDIAL function of ZOC is implemented as a script. 
  2.     #    The Number and BBS-name is given in lastline and are
  3.     #    fetched from there. 
  4.     #    You may modify this script for your own needs.
  5.  
  6.     #    Before you modify this script to call a singe bbs, 
  7.     #    check if the 'Autologin' feature of the phone book 
  8.     #    does not solve your problem already. For a script
  9.     #    calling a single bbs check the SAMPLES directory
  10.     #    (SAMPLES\7_CALBBS)
  11.  
  12.     #    Let's go ...
  13.  
  14.     #   Fetch parameters and number
  15.     #
  16.     seta parmline "%lastline%"    ;# test
  17.     seta number "%parmline%"  |TEL= ; rtrim number
  18.     seta bbs    "%parmline%"  |BOX= ; rtrim bbs
  19.     seta log    "%parmline%"  |LOG= ; rtrim log
  20.     seta init     "%parmline%" |INIT=; rtrim init
  21.     seta waitstr "%parmline%" |WAIT=
  22.  
  23.     exact    1
  24.  
  25.     #    Fetch INIT=xx from the phonebook and eventually send it
  26.     compa    "%init%" WITH ""
  27.     ifnequ    send "%init%"
  28.     ifnequ    wait "OK"
  29.     ifequ     send "^M"
  30.     delay
  31.  
  32.     #    Fetch WAIT=xx from the phonebook or set default value
  33.     compn    "%waitstr%" WITH ""
  34.     ifequ    setn waittime 30 
  35.     ifnequ    setn waittime %waitstr%
  36.  
  37.  
  38.     #   Reset counter
  39.     setn counter 1
  40.     seta msg ""
  41.     cls
  42.     delay
  43.  
  44.  
  45.     #   MAIN LOOP
  46.     #
  47.  
  48. :loop0
  49.     #   wait for something for 90 sec. max
  50.     timeout 90
  51.  
  52.     #    Show status
  53.     seta    status "Call"
  54.     seta    last ""
  55.     call    SayStatus
  56.  
  57.     #    Dial and see what happens
  58.     dial "%number%^i%bbs%"
  59.  
  60. :loop1
  61.     waitline
  62.     ifnbrk seta last "%lastline%"
  63.     ifbrk  seta last "TIMEOUT"
  64.     write  "                           "
  65.     call    SayStatus
  66.  
  67.     exact    1
  68.     compa    "%last%" WITH ""
  69.     ifequ    goto loop1    
  70.  
  71.     exact    0
  72.  
  73.     #    Login for CONNECT, CARRIER or PROTOCOL: LAP-M
  74.     compa    "%last%" WITH CONNECT
  75.     ifequ    goto login    
  76.  
  77.     compa    "%last%" WITH CARRIER
  78.     ifequ    goto login    
  79.  
  80.     compa   "%last%" WITH "PROTOCOL: LAP-M"
  81.     ifequ   goto login      
  82.  
  83.  
  84.     #    Try next time for BUSY, NO CARRIER
  85.     compa    "%last%" WITH BUSY
  86.     ifequ    goto SomeMore    
  87.  
  88.     compa    "%last%" WITH "NO CARRIER"
  89.     ifequ    goto SomeMore    
  90.  
  91.  
  92.     #     Ignore Zyxels saying 'RINGING'
  93.     compa    "%last%" WITH RINGING
  94.     ifequ    goto loop1    
  95.  
  96.  
  97.     #     Ignore modems saying 'RING'
  98.     compa    "%last%" WITH RING
  99.     ifequ    goto loop1    
  100.  
  101.  
  102.     #   For anything else hangup ...
  103.     seta    status "Hangup"
  104.     call    SayStatus
  105.     hangup
  106.  
  107. :SomeMore
  108.     #    ... wait and see if we ...
  109.     seta    status "Wait %waittime% Sec."
  110.     call    SayStatus
  111.     delay     %waittime%
  112.  
  113.     #    ... want to try again?
  114.     inc     counter
  115.     compn    %counter% %with% 99
  116.     iflow    goto loop0
  117.     ifequ    goto loop0
  118.  
  119.     #   No success after 99 tries
  120.     seta    status "No success"
  121.     call    SayStatus
  122.     writeln "^J^J^M"
  123.     goto    finish
  124.  
  125.  
  126.  
  127.     ##################
  128.     #    LOGIN        #
  129.     ##################
  130.  
  131. :login
  132.     beep 3
  133.     writeln "^M^J^J^MConnection established!!"
  134.  
  135.  
  136.     #     Fetch and exec startcmd from phonebook
  137.     seta  cmd "%parmline%" |CMD=
  138.     %cmd%
  139.  
  140.     #    Init Wn/Sn loop
  141.     setn n 1
  142.  
  143.     exact 1
  144.  
  145.     #    Send S0 unconditionally
  146.     seta  s "%parmline%" |S0=
  147.     compa "%s%" with ""
  148.     ifnequ send "%s%"
  149.  
  150.     #    Set name for logging
  151.     compa "%log%" with ""
  152.     ifnequ logname "%log%"
  153.     ifnequ logging 1
  154.  
  155.  
  156.     #    Wait for all Wn from PHONEBOOK and reply Sn
  157. :logloop
  158.     seta  w "%parmline%" |W%n%=
  159.     seta  s "%parmline%" |S%n%=
  160.     compa "%w%" with ""
  161.     ifequ goto finish
  162.  
  163.     rtrim w
  164.     rtrim s
  165.  
  166.     wait "%w%"
  167.     ifbrk writeln "Error: Did not receive '%w%'!!"
  168.     ifbrk goto finish
  169.  
  170.     delay
  171.     send "%s%"
  172.  
  173.     inc n
  174.     goto logloop
  175.  
  176.  
  177.  
  178.     ##################
  179.     #    THE END      #
  180.     ##################
  181. :finish
  182.     exit
  183.  
  184.  
  185. ####################################################
  186. # SUBROUTINES
  187. ####################################################
  188. :SayStatus
  189.     writeln "^[[H^[[1mXDIAL (Abort with Alt '-')^[[m"
  190.     writeln 
  191.     writeln "BOX    : %bbs%"
  192.     writeln "TRY    : %counter% "
  193.     writeln "STATUS : %status%                "
  194.     writeln "MODEM  : %last%                  "
  195.     return
  196.